---
title: "How to Recompile the Stored Procedure in SQL Server?"  
description: "How to Recompile the Stored Procedure in SQL Server?"  
author: "Steilla Mitchel"  
published: 2021-10-21  
updated: 2021-10-21  
canonical: https://www.mindstick.com/forum/156794/how-to-recompile-the-stored-procedure-in-sql-server  
category: "mssql server"  
tags: ["sql server", "sql", "sql-server-2016"]  
reading_time: 2 minutes  

---

# How to Recompile the Stored Procedure in SQL Server?

How to Recompile the [Stored](https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table) [Procedure in SQL](https://www.mindstick.com/forum/158350/what-is-a-stored-procedure-in-sql-server-and-how-to-create-one) [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)?

## Replies

### Reply by Steilla Mitchel

**Recompile the [Stored Procedure](https://www.mindstick.com/articles/803/using-stored-procedure-in-asp-dot-net):**

If you create a stores procedure in [SQL Server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) and execute it then it always in compiled form after it only you have need to execute it. Sometimes cases are generated in that we need to recompile our stored procedure. There are two simple way to recompile the stored procedure like as-

Lets create a Stored Procedure

```
CREATE PROCEDURE usp_ReturnProcedure
AS
BEGIN
  SELECT * FROM Salesman;
  RETURN;
   END
```

1- The following method is used to recompile the stored procedure as well as execute it. By using this method you can recompile your stores procedure while you execute it,

```
EXEC usp_ReturnProcedure WITH RECOMPILE;
```

If you want to only execute the stored procedure then use the following SQL statement

```
EXEC usp_ReturnProcedure
```

2- The second method is only you can recompile your stored procedure here stored procedure is not execute. The following SQL statement is used to recompile the stored procedure,

```
EXEC sp_recompile usp_ReturnProcedure;
```

So you understand differences between above two methods for recompiling of stored procedure. In the first method procedure is recompile as well as execute also and in the second method stored procedure only being recompiles.

\


---

Original Source: https://www.mindstick.com/forum/156794/how-to-recompile-the-stored-procedure-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
