//Check If Table Exists in the database
SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].TABLENAME') AND type in (N'U')
//Check if Index Exists in the Database
SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].TABLENAME') AND name = N'INDEXNAME'