OK
When SQL compares column values with a variable value where the values are diferent data types.
There are 2 posibel methods:
1 Coerce each column value as it is read row by row from the table and compare to the variable
2 Coerce the variable value, cahe the coerced value. Compare tow by row the column value with the cached coerced value
The most efficient method would appear to be 2 as the coercion is only done once.
ALSO
My test database has always had a column with the value 'AB' - and yet the SP has never failed before.
There is clearly something odd going on here. MY suspicion is that it to do with how SQL optimises qurey plans