Create a function/tsql to get strings from the 1st table/data and compare and convert if from the value of second table if the strings would match whats on table 2.

Business example.
When cashier mistakenly encoded ABC1231 as company name instead of ABC the report will have an issue showing ABC1231 instead of ABC. We need to correct this by matching is against a master list of company name in another table.   

Example: 
Table 1 contains -> 

    A121B312C33,AB12312C,ABC,ABC223,AsBCD21,D23EF,D2E2F2,DEF


Table 2 contains -> 

    ABC,DEF

Output should be:

    ABC,ABC,ABC,ABC,ABC,DEF,DEF,DEF