How to know the last database before a procedure (in another database) was called
<p>The caller of the procedure who is in database AAA:-</p>

<pre><code>use AAA
exec BBB.dbo.ap_MyProc
</code></pre>

<p>The procedure being called which is in database BBB:-</p>

<pre><code>use BBB
create procedure ap_MyProc as
print 'We want a way to return the database name AAA'
</code></pre>

<p>Any advice would be appreciated.</p>