To check if a table exists use:
IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'UserLogin'))BEGIN --Do Stuff print 'hello'ENDOutput:hello
IF (EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'UserLogin'))
BEGIN
--Do Stuff
print 'hello'
END