Without seeing your original code ...
- possibility of using object id's to generate code but forgetting the dbid argument to object_name(<objid>[,<dbid>]); for example, a cursor pulling object ids from DB2..sysobjects while running object_name(<objd>) from within DB1
Then with more details started to think ...
- by default procedure query plans are created with references to object id's (as opposed to object names); was thinking there might be an issue here depending on how the proc is built and the actual queries, ie, query plan built with the object id but when executed not picking up the dbid at the same time [CAUTION: WILD GUESS! would likely indicate a bug]
- wondering if there could be an issue with statement cache matching on the object id's as opposed to dbid+object_id or name, though statement cache isn't supposed to be used for exec() calls (though I could be wrong for latest/greatest versions of ASE [CAUTION: another WILD GUESS! would likely indicate a bug]
And then there's ... welllll ... I can come up with all sorts of hair-brained ideas ... hence the reason I asked a couple times for the actual commands being generated => to give us something concrete to work with.