Please try the following T-SQL.
-- DDL and sample data population, start
DECLARE @tbl TABLE (ID INT IDENTITY PRIMARY KEY, Abbr CHAR(3), Code VARCHAR(100));
INSERT INTO @tbl (Abbr, Code) VALUES
('abc', 'AAA'),
('def', 'BBB'),
('ghi', 'CCC'),
('jkl', 'AAA'),
('mno', 'BBB');
-- DDL and sample data population, end
;WITH rs AS
(
SELECT *
, COUNT(Code) OVER (PARTITION BY code) AS counter
FROM @tbl
)
SELECT ID, rs.Abbr
, IIF(counter=1, code, '') AS Code
FROM rs
ORDER BY ID;
Output
+----+------+------+
| ID | Abbr | Code |
+----+------+------+
| 1 | abc | |
| 2 | def | |
| 3 | ghi | CCC |
| 4 | jkl | |
| 5 | mno | |
+----+------+------+