> For the complete documentation index, see [llms.txt](https://katt.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://katt.gitbook.io/wiki/sql/performance/stored-procedures.md).

# Stored Procedures

Making known processes faster

As an important step for making routine needs faster, stored procedures (with the right database) can yield some great speed returns.

```
CREATE PROCEDURE aht_report @dept varchar(255)
    AS
    SELECT agent_id, agent_name, aht
    FROM agents
    WHERE agent_dept == @dept
GO;

EXEC aht_report @dept = 'sales';
```

This requires the user to have the right permissions to be able to make a procedure, and too many procedures can start to bog down a database. Nonetheless, this is a hugely helpful tool for running reports quickly.
