title: SQL Error : The multi-part identifier ... could not be bound
body: <p>I'm currently stuck in this problem in SQL Server and couldn't figure out where the problem is. </p>
  
  <p>I'm using stored procedure for the following code : </p>
  
  <pre><code>DECLARE @cSql nVARCHAR(1000)
  
  SET @cSql = 'SELECT  
              [A].[REC_ID], 
              [A].[ADJUSTMENT_REC_ID], 
              [A].[ITEM_REC_ID], 
              [B].[CODE] [ITEM_CODE],
              [B].[ALIAS_NAME] [ITEM_NAME], 
              [A].[WAREHOUSE_REC_ID], 
              [C].[CODE] [WAREHOUSE_CODE], 
              [C].[NAME] [WAREHOUSE_NAME], 
              [A].[qty_before_basic_uom], 
              [A].[qty_before_uom_1], 
              [A].[qty_adjust_basic_uom], 
              [A].[qty_adjust_uom_1], 
              [A].[qty_after_basic_uom], 
              [A].[qty_after_uom_1], 
              [A].[basic_uom], 
              [A].[uom_1], 
              [A].[ADJUST_VALUE], 
              [A].[cogs_adjust], 
              [A].[cogs_adjust_total], 
              [A].[asset_account_rec_id], 
              [A].[debit_account_rec_id],
              [A].[credit_account_rec_id], 
              [A].[remark], 
              [A].[record_version], 
              [A].[void_status], 
              [A].[void_reason], 
              [A].[void_datetime], 
              [A].[void_user_rec_id], 
              [A].[create_datetime], 
              [A].[create_user_rec_id], 
              [A].[edit_datetime],
              [A].[edit_user_rec_id], 
              [A].[delete_datetime], 
              [A].[delete_user_rec_id] 
              INTO [' + @cTemp + '] 
              FROM [IM_trsInventoryAdjustment_Detail] [A] 
              JOIN [IM_mstInventoryItem] [B] ON
                 [B].[REC_ID] = [A].[item_rec_id] 
              JOIN [IM_mstWarehouse] [C] ON
                 [C].[REC_ID] = [A].[warehouse_rec_id] 
              WHERE 1=0;'
  
  EXEC sp_executeSQL @cSql
  </code></pre>
  
  <p>And as soon as I executed the query, SQL Server springs up <strong>"The multi-part identifier"</strong> error on every single column.</p>
  
  <p>Could you help me locate where my mistake is, please??</p>
  
  <p>P.S. I'm using dynamic query since the temporary table that I'm injecting the data to will keep on changing...</p>