SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER procedure ship_out(@order_name varchar(40)) As exec('create index matchcode on ' + @order_name + '(matchcode)') print('Created index on matchcode successfully') exec('create index nthrow on ' + @order_name + '(nthrow)') print('Created index on nthrow successfully') exec('grant select on ' + @order_name + ' to tools') print ('granted select to tools') exec('nonulls ' + @order_name) print 'nonulls complete' exec('matt_counts.dbo.add_order ' + @order_name + ', ' + '''''') print 'added order successfully' GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO