I believe that most of them follow the X+HD formula. What X is is dependent on creature, but I think 10 or 11 is the most common. There should be a correlation between SR and HD in races like the Formians and even Demons and Devils. I can't be sure; this is just an impression I got when browsing through the MM.
It's usually a rule for templates like celestial or fiendish where it applies to HD and usually only monster HD, not class levels. Pg. 300 in the MM has a sidebar that explains how the SR is typically calculated, which is basically CR + 11. If you add in HD to some monster, I think it would be fair to increase the SR according to that equation.
I sort of remember reading in one of the Monster Manuals that SR was tied to CR, & when the latter went up, the former did also. I think the example used was a dune walker or reaper or something.