title: "Column name or number of supplied values does not match table definition" error only when include actual execution plan is set
body: <p>I have a stored procedure that runs fine in DEV, TEST, and PROD environments. However, only when the include actual execution plan option in SSMS is set and only in PROD, it fails with this error message:</p>
  
  <blockquote>
    <p>Msg 213, Level 16, State 7, Line 1 Column name or number of supplied
    values does not match table definition.</p>
  </blockquote>
  
  <p>In DEV and TEST, it executes successfully with that option set and it executes successfully in PROD without it set. The procedure does an insert into a local temp table from execution of a stored procedure on a linked server. That remote procedure consists of a single SELECT statement.</p>
  
  <p>Does anyone have any ideas as to why the error can occur in this situation and what difference between the instances might result in this difference in behavior?</p>
  
  <p>[Edit: added the code, etc. below.]</p>
  
  <p>This code is in the beginning of the procedure, and it fails on the INSERT:</p>
  
  <pre><code>SET NOCOUNT ON;
  SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
  
  CREATE TABLE #Pricing
  (
      ItemID                  VARCHAR(50)     NOT NULL
      ,ItemType               INT             NOT NULL
      ,ItemName               VARCHAR(255)    NULL
      ,IsProductionProduct    BIT             NULL
      ,CostingPrice           DECIMAL(16, 6)  NULL
      ,TradeAgreementPrice    DECIMAL(16, 6)  NULL
      ,ItemPrice              DECIMAL(16, 6)  NULL
      ,SupplierName           VARCHAR(100)    NULL
  );
  
  INSERT  
    INTO  #Pricing WITH (TABLOCK)
    EXEC  MyLinkedServer.MyDatabase.Finance.GetSkuPricing;
  </code></pre>
  
  <p>The table definition was created by adding "INTO foo" to the SELECT in the remote procedure, running just the SELECT, scripting the CREATE table command of foo from SSMS, pasting it into this proc, changing the table name, and reformatting it.</p>