as fubar says any pilot could fly any aircraft in any position . pilots usually had a regular mount but if it was undergoing maitenence they flew whatever aircraft was avaliabel.
however squdron leaders could if they wanted to use their initals on their normal mount ie jonnie johson (james edgar johnson ) used JE J .
Not squadron commanding officers. They used their squadron codes.
It was commanding officers of wings (i.e. a formation containing multiple squadrons) or larger formations flying operationally that got to use personalised aircraft codes.
Johnson took command of 127 Wing after Christmas 1942 and selected Spitire Mk.IX serial EN398 in March 1943 which seems to have been the first to carry his personalised code JE-J
Douglas Bader as CO of the Tangmere Wing in 1941 used D-B on his Spitfire and again in 1945 post war but this time as DB forward of the roundel.
Ian Gleed as CO of 244 Wing in North Africa in 1942/3 used IR-G
Stanislaw Skalski, a Pole, used SS on his Mustang III in early 1944 when commanding 133 Wing. His successor later in 1944 was a chap by the name of ? Nowierski who used TN on his mount.
The whole system of squadron codes can get very complicated. For example when war broke out there was a wholesale change of squadron letters as a security measure to confuse the enemy. During WW2 changes of code by squadrons was not unknown. For example 617 squadron used AJ in 1943 but later changed to KC. Overseas many RAF squadrons carried no squadron letters, just aircraft letters. And later the same squadron letters could be used simultaneously in different theatres forcing changes if squadrons moved between theatres. And Coastal Command had its own aircraft coding system for a good part of WW2. Initially some letters (I & C for example) were not used to avoid confusion. Later as demand for letter combinations increased, particularly with the arrival of USAAF units those letters had to be used as were letter/number squadron code combinations.
In Bomber Command as aircraft numbers on an individual squadron increased beyond the letters of the alphabet, a third C flight might be formed using a different squadron code. Alternatively to allow the same aircraft letter to be used twice on a squadron, a horizontal bar would be used above / below the aircraft letter on one to differentiate it from the other.
Entire books have been written on the subject.