Thanks for your help. I made a slight mistake before, the column name is not a variable but fixed as AISref. It is the update value which is a variable. So basically I want my update statement to readUPDATE Tablename SET AISref = 'value'
but when I print the @sql variable its reading without the single quote. UPDATE Tablename SET AISref = value
here is my code CREATE PROCEDURE usp_updatetable@Tablename varchar(100), @ProjectRef varchar(20)ASBEGIN DECLARE @SQL VARCHAR(2000)SET @SQL = 'UPDATE ' + @Tablename + 'SET AISref = ' + @ProjectRef + ''EXEC (@SQL)PRINT @SQLENDEXEC usp_updatetable @Tablename = 'table1', @ProjectRef = 'value'