Ask Copilot in SSMS to SELECT TOP 100 * FROM Sales.Orders on a login that has no rights to that table, and the query fails exactly the way it would if you ran it yourself. That single detail tells you more about what this feature is than any marketing page. Copilot in SQL Server Management Studio doesn't sit outside your session pretending to be helpful — it runs inside it, under your login, against your connection, bounded by your permissions.
That framing matters because "AI in a SQL editor" is easy to dismiss as a fancier snippet menu. What actually ships in SSMS 22 is something more specific: an assistant wired into the database context most chat tools never get to see.
Where it lives and how to turn it on
Copilot in SSMS is now GitHub Copilot in SSMS, generally available as of SSMS 22.4.1. The older SSMS 21 preview was a separate, Azure OpenAI–based implementation; if you're still on it, that path is a dead end and you should move to 22.
Requirements are short: SSMS 22 or later, and a GitHub account with Copilot access — or a free tier you can sign up for from the chat window. If the extension isn't present, add it through the GitHub Copilot badge in the top-right corner, or open the Visual Studio Installer and check the AI Assistance workload:
Visual Studio Installer → SSMS → Modify → Workloads → AI Assistance → Modify
Sign in once, connect a query editor to a database, and the chat window picks up that connection automatically. Supported back ends run from SQL Server 2014 through 2025, plus Azure SQL Database, SQL Managed Instance, SQL Server on Azure VMs, and SQL database in Fabric.
The context model is the whole point
The reason this beats pasting SQL into a general-purpose chatbot is that Copilot already knows things you'd otherwise have to spell out. By default it reads three pieces of implicit context from the active editor: the currently selected text, the current file, and the database connection behind it. Ask "why is this query slow?" with a statement highlighted, and it's answering about that statement against that schema.
You extend that context deliberately:
#file references — mention another open file by name, like #GetSalesInfo.sql, to pull it into the prompt without pasting.
- The results pane (SSMS 22.5+) — after a query runs, ask about the grid or the messages tab directly: "what's the total ItemPrice for lines 1 through 10?" If an actual or estimated execution plan is showing, "how do I optimize this query based on the execution plan?" reads the plan, not a guess.
- Custom instructions — a file in your repo root or
USERPROFILE folder where you encode T-SQL conventions and formatting rules once, so you stop repeating them.
- Database instructions — business rules and data conventions stored in the database itself, so every developer's Copilot inherits the same domain context instead of re-learning it per person.
That last pair is the difference between an assistant that writes plausible SQL and one that writes SQL your team would actually approve.
Slash commands for the work you do most
Highlight a query and set an intent. These work in both the chat window and inline chat:
| Command |
What it does |
/explain |
In-depth breakdown of the selected T-SQL. |
/fix |
Returns a corrected version plus an explanation of what was wrong. |
/optimize |
Flags anti-patterns and rewrites toward T-SQL best practices. |
/doc |
Adds comments so the next person understands the query. |
/help |
Help on using Copilot Chat itself. |
/fix and /optimize are the ones that earn their keep. Because Copilot can see the execution plan and the connected schema, /optimize on a query with a visible plan gives grounded suggestions — a missing index, a non-SARGable predicate — rather than generic advice.
Completions, next edits, and agent mode
Beyond chat, Copilot offers inline code completions (since SSMS 22.2) that appear as gray ghost text as you type, and Next Edit Suggestions, which anticipate your following change based on what you just edited — useful when you're renaming a column across a long statement.
The bigger shift is Agent mode (preview), added in SSMS 22.7. Instead of one prompt/one answer, you give it a high-level goal and it works through the steps: executing queries, reading execution plans, and modifying schema — the last two gated behind your approval. You can extend it with agent skills and MCP servers to reach external tools. The permission boundary from the opening still holds here: an agent acting under a low-privilege login can't quietly do what that login can't do, which is the guardrail that makes autonomous execution against a database tolerable at all.
Models and data handling
You're not locked to one model. The model picker exposes a curated set — GPT-5.4 and GPT-5.5, Claude Sonnet 4.6 and Opus 4.8, Gemini 3.1 Pro, and others — with the default varying by subscription. On Copilot Free, Pro, or via bring your own model, you can plug in keys from OpenAI, Anthropic, Google, xAI, Azure, or Foundry Local (BYOM is unavailable on Business and Enterprise).
On privacy, the documented position is unambiguous: GitHub Copilot in SSMS doesn't retain your prompts, responses, or metadata, and doesn't train models on your data. It may send your SQL version and some database information alongside a prompt to sharpen the answer.
What it won't do
Two limits are worth internalizing. First, Copilot can produce inaccurate results when the intent is to evaluate data — treat it as a query author, not an analyst who reports numbers you act on unread. Second, there's no chat export yet, so anything you want to keep, you copy out.
The practical takeaway: stop thinking of this as autocomplete and start treating it as a session-aware pair. Load it with context on purpose — commit a database-instructions entry describing your naming and business rules before your team writes a single prompt against a schema. That one step is what turns generically correct T-SQL into T-SQL that fits the database it's running in.
Sources: What Is GitHub Copilot in SSMS? — Microsoft Learn, Get Started with GitHub Copilot in SSMS, Chat Context — Microsoft Learn, AI Models — Microsoft Learn