Don't do it in SQL.
SQL string handling is - at best - pretty basic.
And what you want to do is pretty complicated.
Seriously: This is overkill for your purposes, probably, but it's an advanced form of what you are asking for:
Levenshtein Edit Distance Algorithm[
^]
Do this in your "real" programming language, whichever that is. SQL is a poor choice.