USE [xyy_erp] declare @tableCount int =0 select @tableCount= count(*) from information_schema.tables where table_name='{0}' if(@tableCount =0) begin SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE TABLE [dbo].[{0}]( {1}) end