sp_rename stored procedure.Syntax:
EXEC sp_rename 'table_name.old_column_name', 'new_column_name', 'COLUMN';
Example :
EXEC sp_rename 'users.fullname', 'full_name', 'COLUMN';
This renames the column
fullname to full_name in the users table.Notes:
-
Make sure the column you're renaming is not used in indexes, constraints, or stored procedures without updating those references.
-
sp_renamecan also rename tables and other objects if you change the last argument.
