We can use the sys.procedures catalog view to check the existence of a stored proedure.
Here in the below script we are checking the existence of the stored procedure spAgent.
Example:
Here in the below script we are checking the existence of the stored procedure spAgent.
Example:
IF EXISTS(SELECT 1 FROM sys.procedures
WHERE Name = 'spAgent')
BEGIN
PRINT Exists'
END
else
begin
PRINT 'Exists'
End
0 Comments