The judge who had been the person's defence counsel might, conceivably, excuse himself from the trial ten years later, but that's pretty unlikely.It would require some unusual circumstances,which would bar any judge on grounds of partiality, such as a strong friendship having developed between them in subsequent years or the defendant having committed some crime against the judge himself.
Defence counsel are not friends or judges of clients, they are just defending them and that is an impersonal arrangement; defence counsel is there to get a result, and doesn't care what kind of person the client is , good, bad or average. They may, indeed, have prosecuted them or defended them and then done the reverse in some later trial, which does sometimes happen, particularly when the defendant is a serial offender.
And, as counsel, the judge is unlikely to have had ( or remember), any material information, adverse to the defendant, which is not now before him in a trial or sentencing.