Record the keyboard track
Record the vocal track
Create a V-Vocal over the keyboard track
Create a V-Vocal over the vocal track
Compare the patterns of the two and adjust the vocal so it looks like the piano pattern
Got to watch for artifacts or fake sounding fixes on the vocal track so you may only be able to get it close
I've done that with two verses (lines) that have same melody but different words - I can't cut and paste so I need to compare the patterns in v-vocal then try and match them as much as possible...