As written above you are correct, the first bit isn't doing anything because it's negated by the last bit:
;WITH cte AS (SELECT 'XYZ' AS CodeValue
UNION
SELECT 'A')
SELECT *
FROM cte
WHERE (CodeValue between 'A' and'Z' or CodeValue in ('ABCDEFG'))
AND CodeValue NOT in ('XYZ', '1234', 'Etc')
OR CodeValue between 'A' and 'Z'
Will Return XYZ
even though XYZ
is listed in the NOT IN
portion.
Demonstration: SQL Fiddle