If you want cannot change the code, but you want to ignore divide by zero errors (to get null instead), you can use the ARITHABORT and ANSI_WARNINGS settings, like this:
SET ARITHABORT OFF
SET ANSI_WARNINGS OFF
SELECT 1/0 -- you will get null
You will also get a warning (but not an error). If you want to suppress the warning too, use SET ARITHIGNORE ON.
Warning: using these options may cause some other problems, including the fact that you can't use indexes on computed columns.
My favourite way to handle such errors (without changing the default settings) is:
DECLARE @a money, @b int
SELECT @a=1, @b=0