title: How to check if a variable has a value in a SQL Server 2008 stored procedure
body: <p>I need to check whether a variable has a value or not. </p>
  
  <pre><code>declare @name varchar(20)
  
  set @name = (SELECT Product_Name 
               FROM tb_new_product_Name_id 
               WHERE Product_Name = @productName)
  
   if (@name )   // here I need to check it 
  </code></pre>
  
  <p>How to do it? thanks</p>