title: Column name as a parameter in INSERT statement
body: <p>I want to create one <strong>stored procedure</strong> where i want to insert values in a table. 
  But i don't know in which field i have to insert values and at the 
  <strong>runtime i will decide in which field the values should be inserted</strong>. 
  What i want to do is</p>
  
  <pre><code>insert into Tablename(@ColumnName, Description) 
  values (@ColumnValue, @MH_Description)
  </code></pre>
  
  <p>Can it possible that i pass this type of parameters in stored procedure as shown in the example above??</p>
  
  <p>I want to use conditions too as</p>
  
  <blockquote>
    <p>declare @Query nvarchar(4000)
        declare @Query1 nvarchar(4000)
        declare @ParmDefinition nvarchar(500);</p>
  
  <pre><code>set @Query = '
      insert into tbl_temp(' + quotename(@ColumnName) +',Description)
  
      values (@ColumnValue, @Description)'
      set @Query1 = '
      update tbl_temp set' + quotename(@ColumnName) +'=@ColumnValue, Description=@Description'
  set @ParmDefinition = N'@ColumnValue varchar(100),@Description varchar(100)'
  if exists(select 'true' from tbl_temp where quotename(@ColumnName)=@ColumnValue)
  begin         
    exec sp_executesql @Query1, @ParmDefinition, @ColumnValue = @ColumnValue, @Description = @Description
  end
  else 
  begin      exec sp_executesql @Query, @ParmDefinition, @ColumnValue= @ColumnValue, @Description = @Description
  end
  </code></pre>
  </blockquote>
  
  <p>What am I doing wrong?</p>