M,
Place your code, or a call to the code, in your Program Files\AutoCAD 2009\support\acaddoc2009.lsp. This will then run every time a drawing is opened.
Regarding your IF statement you'll need to get the block list either by vl- methods or an (ssget "X" '((0 . "INSERT"))) and loop through looking for particular block types or names. If you have a known list of blocks that you are looking for you could put that in your (ssget). Then use the result of this search in your IF.
Pologies for not offering more but I'm using LT at the moment.
S