title: Error Using Temporary Tables With Same Names SQL Server
body: <p>Here is my scenario. (Following is my stored proc taking @date as an input parameter)</p>
  
  <pre><code>DECLARE @date DATE
  
  If object_id('tempdb..#TempList') is not null drop table #TempList
  go
  
  Create table #TempList (MILL_NO VARCHAR(7), SHIP_DATE DATE, BL_STATUS NCHAR(1), 
  FOOTAGE DECIMAL(12,4))
  
  If @date IS NULL
  
  Insert into #TempList
  Select mill_no, null, bl_status,footage from fn_A(0,0)
  
  Select * from #TempList
  
  
  If object_id('tempdb..#TempList') is not null drop table #TempList
  go
  
  Create Table #TempList (MILL_NO VARCHAR(7), SHIP_DATE DATE, BL_STATUS NCHAR(1),
  FOOTAGE DECIMAL(12,4))
  
  If @date IS NOT NULL
  
  Insert into #TempList
  Select * from fn_B(0,'06/06/2006')
  
  Select * from #TempList
  </code></pre>
  
  <p>I figured out from one of the posts that I cannot use temporary tables with same names unless I inclide a GO. However, including GO is not taking the parameters I try to pass.</p>
  
  <p>Is there an alternate approach to eliminate this error?</p>