I have a SQL query stored in a table that contains parameter names. I need to know how to execute it properly in a stored procedure.

This is my SQL code in the procedure

```
PROCEDURE [spMassUpdateSKUs]
@SKU AS NVARCHAR(20)
,@FIELD AS NVARCHAR(50)
,@VALUE AS NVARCHAR(50)
,@RESULT as Int = Null Output
AS
BEGIN
IF EXISTS(SELECT CODENUMBER FROM INVENTORY_MASTER WHERE CODENUMBER=@SKU)
    BEGIN   
    DECLARE @SQLQUERY AS NVARCHAR(50)
    SET @SQLQUERY=(SELECT SQLUPDATE FROM MASS_UPDATE WHERE DROPDOWNLABEL=@FIELD)
    EXEC SP_EXECUTESQL @SQLQUERY
    END

```

and this is the sql query from the table

```
update inventory_master_flex set departmentid=@value where codenumber=@sku

```

I've tried replacing with the real parameters but that doen't work.

```
SELECT REPLACE(REPLACE(@SQLQUERY,'@VALUE',@VALUE),'@SKU',@SKU)

```