In this article, we will show you, How to Rename Column in SQL Server with an example. In SQL Server, there is a standard stored procedure called SP_RENAME to rename column name.
The syntax behind this Sql Server Rename Column approach is as shown below:
-- Syntax for SQL Server rename column Name is: SP_RENAME '[Table Name].[Old Column Name]', '[New Column Name]', COLUMN'
SQL Rename Column Example
In this example, we will rename the column using this SP_RENAME stored procedure. To demonstrate the Rename Column, We are going to use the below-shown Customers table.
We are going to use above specified SQL Server syntax to rename the YearlyIncome to a new name: Income
-- SQL Server Rename Column Name query is: USE NewNameDB GO SP_RENAME 'Customers.YearlyIncome', 'Income', 'COLUMN'
From the below screenshot you can see the changed column
Rename Column using SSMS
If you can access the Management Studio then you can use the following steps to change or rename column in Sql Server. Right-click on the Table, and select the Design from the context menu.
Selecting the Design option will open the table in design mode.
Let me rename the Income column to Annual Income
Click the Close button will display the pop-up window. Please select the Yes button to save the changed that you made in the design window.
Now you can see the changed column.
Thank You for Visiting Our Blog