title: How do I drop a declared variable DB if it exists?
body: <p>I'm trying to drop a declare variable DB name if it already exists. I have the following, but keep on getting a syntax error. <em>Incorrect syntax near '@DB_NAME'.</em></p>
  
  <pre><code>USE MASTER  
  GO
  
  
  DECLARE @DB_NAME AS VARCHAR(50) 
  SET @DB_NAME = 'TEST' 
  DECLARE @DB_PATH AS VARCHAR(200) 
  SET @DB_PATH = N'C:\\Clients\\TEST PILOT\\F - Raw Data\\'
  
  
  IF EXISTS(SELECT * FROM sys.sysdatabases where name=@DB_NAME) 
  DROP @DB_NAME
  
  CREATE DATABASE @DB_NAME  
  ON 
         (NAME = N'@DB_NAME', 
      FILENAME = N'C:\\Clients\\TEST PILOT\\F - Raw Data\\TEST.mdf', 
      SIZE = 1GB , 
      MAXSIZE = UNLIMITED, 
      FILEGROWTH = 1GB
      )
  
  LOG ON
      (NAME = N'TEST_log', 
       FILENAME = N'C:\\Clients\\TEST PILOT\\F - Raw Data\\TEST.ldf', 
       SIZE = 2024KB , 
       MAXSIZE = 2GB , 
       FILEGROWTH = 10%
      )
  GO 
  </code></pre>