If you need to insert into different databases from the same source database, use dynamic SQL just as others say.
However, if the problem is that you want to syncronize devserver1 with devserver2, and prodserver1 with prodserver2, and have the other database as a config option, then use synonyms.