How can I replace constants 5,6 & 8 in sql instead of in condition In the following query, I would like to make the values in the IN dynamic.

SELECT DISTINCT party_id 
INTO #tmp_new_part
FROM #party_approval
WHERE party_approval_type_id in (5,6,8)
It depends whether the values you want to go in the IN list are from an existing table or from a SQL parameter. If they are from an existing table or query you can do something like this:

SELECT DISTINCT party_id 
INTO #tmp_new_part
FROM #party_approval
WHERE party_approval_type_id in (select party_approval_type_id from some_table)


If you want it to be based on parameters to a stored procedure, you can pass a varchar containing a delimited list of values, and use one of the many existing UDFs to split it into a table variable, similar to below:

SELECT DISTINCT party_id 
INTO #tmp_new_part
FROM #party_approval
WHERE party_approval_type_id in (select * from dbo.CsvToInt(@values))