in reply to sql server procedure
if not exists (select cust_id from X where cust_name = @name) insert into X(cust_name) values (@name) [download]
Beware race conditions