– this will return the user account login, usually like database\username
– generally the same result, but if the context was changed, this will reflect the current user context instead of the original login above
I don’t know of a way to get the name of the procedure that actually called your procedure.
However, you can easily find out the names of all the defined procedures/functions that directly call your procedure (at least where they were compiled with a reference to your procedure).
<pre>select so.name ‘Object Name’, so2.name ‘Dependent On’ –, sd.*
from sys.sysdepends sd
join sys.objects so on so.object_id = sd.id
join sys.objects so2 on so2.object_id = sd.depid
where so2.name = ‘ my procedure name ‘</pre>
Of course, this won’t show any calls that are dynamically generated – only those that were compiled.