I would suggest something like:
IF EXISTS
(
SELECT *
FROM SYSPROCS
WHERE SPECIFIC_SCHEMA = ???
AND SPECIFIC_NAME = ???
AND ROUTINE_SCHEMA = ???
AND ROUTINE_NAME = ???
)
DROP PROCEDURE ???
I donβt know if you need SPECIFIC_ * information or not, and I donβt know how to handle cases when you have two procedures with the same name but different call signatures, but hopefully this will help you track correctly.
Tom h source
share