Drop All Stored Procedures for SQL Server
/******************************************************/
/** Description:Deletes all Stored Procedures in the **/
/** given Database. **/
/** **/
/** WARNING: This can be very Dangerous. Verify **/
/** your current Database connection **/
/** before use. It is recommended to **/
/** enter the Target Database in the **/
/** USE clause. **/
/** **/
/** Source: http://bit.ly/DropAllProcedures **/
/******************************************************/
USE [EnterDatabaseNameForSafety]
DECLARE @procName VARCHAR(500)
DECLARE procCursor CURSOR FOR
SELECT [Name]
FROM sys.objects
WHERE Type = 'p'
OPEN procCursor
FETCH NEXT FROM procCursor INTO @procName
WHILE @@fetch_status = 0
BEGIN
EXEC('drop procedure ' + @procName)
FETCH NEXT FROM procCursor INTO @procName
END
CLOSE procCursor
DEALLOCATE procCursor