Processing stored procedures

Under some circumstances, the dbid of a temporary object is remapped to the temporary database ID of the current session to ensure that these objects are created and accessed in the correct temporary database. For example:

However, remapping temporary database IDs does not ensure that the procedure behaves identically across temporary databases. A procedure compiled in one temporary database with certain caching characteristics may perform very differently when run in a temporary database with a different set of caching characteristics. Similarly, a procedure compiled in one temporary database with certain dboption settings may have very different semantics when executed in a temporary database with different dboptions settings.