I had to rename in a column in my database - let's call it Customer.CellPhone. Now 'CellPhone' needs to be 'Mobile'. Not to hard using the build-in SP:
use WebShop
EXEC sp_rename 'Customer.CellPhone', 'Mobile'
go
But what if I used 'CellPhone' in a SP? Then it would fail now... But that's when I found this solution.
create proc spFindWordsInSP
@word nvarchar(100)
as
BEGIN
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%'+@word+'%'
AND ROUTINE_TYPE='PROCEDURE'
ORDER BY ROUTINE_NAME ASC
END
Calling EXEC spFindWordsInSP 'CellPhone' returns all the procedures, where the word You search for is located!
Follow this link to the original article by dotnetfish: http://www.codegain.com/tips/sqlservers/databaseadmin/how-to-find-column-name-within-stored-procedures-in-sql-server.aspx