How to rename aliases

SQL Complete generates aliases automatically for tables, views, table-valued functions, and synonyms.

You can rename default aliases directly in the code. All references to the renamed aliases will be automatically replaced with the relevant ones.

To rename an alias:

1. In the SQL code editor, place the cursor over the alias you want to rename and use one of the following options:

  • Right-click the alias and select Rename.
  • Go to the SQL Complete menu and then select Rename.
  • Press F2.

The alias will be highlighted.

2. Enter a new name for the alias. As you type, a tooltip appears instructing you to Press F2 to preview changes or Enter/Tab to apply.

3. Optional: To display the preview dialog, press F2. In the Preview Changes - Rename dialog that opens, preview the code changes and click Apply to apply them.

4. To proceed without preview, press Enter/Tab to apply your changes in the code.


In case the alias and the column name are the same, the renaming of the alias does not affect the column name.

Let’s take the following procedure as an example:

  @EmailAddress VARCHAR(30) = '%'
  DECLARE @EmailAddressList VARCHAR(30)
    email.EmailAddressID AS EmailID
  FROM Person.EmailAddress email
  WHERE email.EmailAddress LIKE @EmailAddress;
EXECUTE Person.EmailAddressID @EmailAddress = 'adriana%'

Try to rename the alias in the query using the built-in SSMS Find & Replace functionality. As you can see, the names of the procedure and its parameters have been changed as well.

Renaming aliases

Now, try to rename the alias in the query with the SQL Complete Refactoring feature. As you can see, the renaming of aliases does not cause the renaming of the procedure and its parameters.

Renaming aliases


You can undo any action by pressing Ctrl+Z.

Example: Rename an alias in the SELECT query in the procedure code