DECLARE @SearchKey VARCHAR(60)
DECLARE @HotelSetupNumber INT
DECLARE @cnt INT

DECLARE db_cur CURSOR FOR
  SELECT SearchKey, HotelSetupNumber
  FROM HotelSetup WITH (NOLOCK)
  WHERE CHARINDEX(CHAR(0), SearchKey) > 0
OPEN db_cur

FETCH NEXT FROM db_cur INTO @SearchKey, @HotelSetupNumber

WHILE @@FETCH_STATUS = 0
BEGIN
  PRINT REPLACE(@SearchKey, CHAR(0), '')
  SELECT @cnt = COUNT(*) FROM Hotelsetup WHERE SearchKey = REPLACE(@SearchKey, CHAR(0), '')
  IF ISNULL(@cnt, 0) > 0
    DELETE HotelSetup WHERE SearchKey = @SearchKey
    
  FETCH NEXT FROM db_cur INTO @SearchKey, @HotelSetupNumber
END

CLOSE db_cur
DEALLOCATE db_cur

UPDATE HotelSetup SET SearchKey = REPLACE(SearchKey, CHAR(0), '')
WHERE CHARINDEX(CHAR(0), SearchKey)>0