Conditionally use computed column
An example:


CREATE TABLE test (id INT,
                   val INT);
GO




CREATE TRIGGER tr
ON test
AFTER INSERT, UPDATE
AS
UPDATE test
SET val = 123     -- custom value which must be set instead of NULL
                  -- maybe any expression 
                  -- and even an output of the subquery
WHERE EXISTS ( SELECT NULL
               FROM INSERTED
               WHERE id = test.id
                 AND val IS NULL );
GO




INSERT INTO test VALUES (1,1), (2,null), (3,3);
SELECT * FROM test;
GO


id | val
-: | --:
 1 |   1
 2 | 123      -- NULL is replaced with custom value
 3 |   3




UPDATE test SET val = NULL where id = 1;
SELECT * FROM test;
GO


id | val
-: | --:
 1 | 123      -- NULL is replaced with custom value
 2 | 123
 3 |   3


db&lt;&gt;fiddle here