How to mention declared integer in where condition using dynamic sql?
IMHO the best option to deal with dynamic SQL is:

Build your command
PRINT the resultant text.
Copy &amp; paste and execute it in a new query window just to check it.

Example:
CREATE TABLE t (id int identity, foo varchar(10));

INSERT INTO t VALUES ('RED'),('GREEN'),('BLUE');

DECLARE @cmd NVARCHAR(MAX);
DECLARE @param VARCHAR(10) = 'GREEN';

SET @cmd = 'SELECT id, foo FROM t WHERE foo = ' + @param

PRINT @cmd;

Then execute the command:
SELECT id, foo FROM t WHERE foo = GREEN

SELECT id, foo FROM t WHERE foo = GREEN

Msg 207 Level 16 State 1 Line 1
Invalid column name 'GREEN'.

db&lt;&gt;fiddle here