I have an org file with lots of babel source blocks in it that only need to be re-executed when the code is changed.
How do I prevent org from executing all of the block
You can set the cache to yes (see http://orgmode.org/manual/cache.html). This can also be set a property line in the file to act globally. #+Property: header-args :cache yes just make sure to C-c C-c on that line to activate the property.
cache
#+Property: header-args :cache yes
C-c C-c