For the best web experience, please use IE11+, Chrome, Firefox, or Safari

SQL formatter

ApexSQL Refactor is a SQL Server Management Studio (SSMS) and Visual Studio formatting and refactoring add-in for SQL Server with nearly 200 formatting options and 15 refactors such as table partitioning, safe rename, wildcard expansion and more.
An introduction to ApexSQL Refactor 08:25


  • SQL formatter with over 160 options

  • Qualify objects and expand wildcards

  • Encapsulate SQL into procedures

  • Add surrogate keys

  • Replace one-to-many relationships

  • Change procedure parameters

  • Safely rename SQL objects

  • Locate & highlight unused variables

  • Format SQL objects

  • Obfuscate SQL


Impact analysis

Preview the impact of SQL formatter changes with difference highlighting

Advanced SQL formatting

SQL formatter with over 160 customizable options

SQL formatter profiles

Save and quickly toggle between different sets of formatting settings

Batch formatting of SQL objects

Use the database-level SQL formatter to format all script based objects e.g. stored procedures, in a database, quickly and easily. Learn more


Make SQL code less readable

Wildcard expansion

Transform * wildcards into explicit lists of column names. Learn more

Object name qualifying

Qualify columns with schema table names and schema or aliases. Learn more

Find unused variables and parameters

Clean up your code by identifying and removing parameters and variables that aren’t used. Learn more

Safe rename

Rename tables, procedures, views, functions and columns risk-free. Learn more

Add surrogate key

Replace complex, multi-column primary keys with a single column surrogate key. Learn more

Replace one-to-many relationships

Add a new associative table to replace one-to-many relationships. Learn more

Change parameters

Add, remove or change parameters without breaking dependencies from referencing objects. Learn more

Encapsulate SQL

Convert blocks of SQL code into scalar or table functions, stored procedures and views. Automatically identify and create the input parameters. Learn more

Split table

Improve your database design and make large tables more manageable by partitioning them. Learn more

Convert to code

Render T-SQL into its Java, C#, C++, VB .NET, PHP, Ruby or Delphi equivalent. Learn more

Command Line Interface

Format SQL from the command line. Learn more

Related Topics


Hostcentric Inc.

The ApexSQL Refactor SQL formatter is a great help, and I'm glad to have found something that works well and is easy!

Alex Gadea Sr. VP of Operations, Hostcentric Inc.

Software Developer Consultant

I'm a user of ApexSQL Refactor and I find it a really wonderful product.

Paolo FRANCESCHINI Software Developer Consultant

Jeeves Information Systems AB

I tried the ApexSQL Refactor product and liked it a lot. This is something I have been thinking would make my life a lot easier.

Mathias Hedlund System Developer, Jeeves Information Systems AB

I used ApexSQL Complete and ApexSQL Refactor. Both are well designed and include all the modern feature compare to other competitors. I found tons of customization options that makes your tools powerful.

Mohammad Sanati Software & Database developer,


ApexSQL Refactor is essential to keeping formatting standards on my team without getting overwhelmed. Everyone can format as they want, but when it’s production-ready, it all fits the standard. I reach for the formatter after every edit; it’s second-nature.

Steven Hibble Senior Database Developer, Communicus

Get started now

Seamlessly integrate a SQL query formatter directly into SQL Server Management Studio (SSMS) and Visual Studio.