1 The title of the Psalm has: “At the end, understanding of David, when there came Doeg the Edomite and told Saul, David has come into the house of Abimelech:” whereas we read that he had come into the house of Achimelech. And it may chance that we do not unreasonably suppose, that because of the similarity of a name and the difference of one syllable, or rather of one letter, the titles have been varied. In the manuscripts, however, of the Psalms, when we looked into them, rather Abimelech we have found than Achimelech. And since in another place you have a most evident Psalm, intimating not a dissimilarity of name, but an utterly different name; when, for instance, David changed his face before King Achish, not before king Abimelech, and he sent him away, and he departed: and yet the title of the Psalm is thus written, “When he changed his countenance in the presence of Abimelech” — the very change of name makes us the rather intent upon a mystery, lest you should pursue the quasi-facts of history, and despise the sacred veilings....
Source: The Enarrations, or Expositions, on the Psalms (New Advent)