disable the indexes on the table first
ALTER INDEX IndexName ON tableName DISABLE
GO
while 1 = 1
begin
delete top ( 10000 )
from tablename
where Someconition
if @@rowcount = 0 BREAK
end
ALTER INDEX IndexName ON tableName enable
GO
ALTER INDEX IndexName ON tbMessages REBUILD
GO