You can use the @@SERVERNAME system variable and the RAISERROR function to do this.
IF @@SERVERNAME IN (‘Prod01’, ‘Prod02’, ‘Prod03’)
RAISERROR (‘This is a production system’, 16, 1)
This will only terminate the current batch. If you have a GO separator after this the next batch will start.