There is a case when you need to check if a stored procedure in SQL Server exists. Especially if you build an application that requires some upgrade. There is a time you need to replace the existing stored procedure with the new one.
Below is the SQL query to check if the existing stored procedure and delete the existing stored procedure.
IF EXISTS (SELECT * from dbo.sysobjects WHERE Id = object_id(N'dbo.MyStoredProcedureName') and OBJECTPROPERTY(id, N'IsProcedure') = 1) DROP PROCEDURE dbo.MyStoredProcedureName GO
Once it has been deleted, you can delete it again. Alternatively, if you prefer not to delete it, you can use the option to update by using the keyword ALTER.