Just disconnect the negative (-) terminal first, then the positive (+) terminal. Replace the battery, reconnect the positive (+) terminal first, then the negative (-) terminal. The alarm should not be affected.
If, after reconnecting the battery, the alarm *does* sound, it's likely due to a problem with the alarm system itself, a faulty connection, or a low battery in the alarm's backup system (if it has one). Consult your alarm system's documentation (if you have it) or seek help from a qualified auto electrician or alarm installer.