Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Sean Smith,
I recently came across some code where various input parameters were declared in the creation of a stored procedure though weren't actually being used anywhere in the script. As it turned out, the developer had modified the code at some point, removing these parameters as they were no longer needed for filtering purposes, but forgot to remove them from the input parameter list.
The stored procedure below will scan all relevant objects and return any that have unused input parameters, outputting the following:
To execute the stored procedure simply pass it the name of the database to search against:
@Database_Name = N'my_database'
NOTE: Always make sure that no other objects or applications are referencing any input parameters that you decide to remove. For example: if you remove an input parameter from procedure A, but procedure B calls procedure A and passes to it one of the now removed parameters then you will also need to update procedure B's call to procedure A.
Any friendly feedback is always welcome. Enjoy!
How to make input parameters mandatory in Stored Procedure ?
Execute Stored Procedure with Select Statement as Input Parameters
Parameterised Input stored procedure
xml input for stored procedure
Input and output parameter