Current executing procedure name

Sergey Metlov picture Sergey Metlov · May 17, 2011 · Viewed 69.2k times · Source

Is it possible to get the name of the current Stored Procedure in MS SQL Server?

Maybe there is a system variable or function like GETDATE()?

Answer

Alireza Maddah picture Alireza Maddah · May 17, 2011

You may try this:

SELECT OBJECT_NAME(@@PROCID)

Update: This command is still valid on SQL Server 2016.