is asked before :
have a block routine but some say it's rather complicated to drive so to spreak so I won't repost or refer to it , but the way my batch application works in case of mdi mode is to start a new drawing , save and close all open drawings and then reopen them and run all the scripts & commands I want. Totally dragon proof and totally don't care about the few seconds longer it takes compared to vba / odbx.
if you do want to use the fast lane (not sure about dynamic blocks though) the way my block routine handles it is for each block get its properties (inspoint , rotation etc) and all the attribute values , then burn them all , sorry can't help m'self , then delete them all , purge block definition , and then re-insert them one by one and transfer attribute data.