If the target which is having the ability removed does not have that ability during the resolution of this effect, then this effect still grants the chosen ability. The reason is that the second target is still legal even if the first one is not.