The answer is: you cannot run heavy scripts and not slow down the DB server.
I quess all you have to do is to pick kind of light-workload-hours and REBUILD
indexes one by one with your own hands monitoring blocking and overall server load.
General advice would be to use
ALTER INDEX <IndexName> ON IndexTest REBUILD;
instead of recreating them.
Also consider ALTER INDEX
options here such as:
- ONLINE
- RESUMABLE
- MAX_DURATION
- MAXDOP
- WAIT_AT_LOW_PRIORITY
Have a look at these useful links:
Take care about free space when rebuilding online, as stated here.