I have some stored procedures that call another SP which sends out mails(SP_SendMail).
I need the calling SPs to pass their own name to the SP_SendMail as a parameter.
I don't want to hardcode each SP's name inside it. I want a common code, something like:
declare @CallingSPName varchar(100)
set @CallingSPName = @@MyName
exec SP_SendMail @Body, @To, @From, @Subject, @CallingSPName
Is there a way I can achieve this, without actually typing the name of the SP inside it?