What is the hadith that says that the Sahabah, when the Prophet was alive used to say in the tashahhud in the salah, "Assalam Alaik ..." but when the Prophet died they say "Asalam Alla ...". I will also like to know how it changed?
This should be the Hadith you are looking for:
Narrated Ibn Mas`ud:
Allah's Apostle taught me the Tashah-hud as he taught me a Sura from the Qur'an, while my hand was between his hands. (Tashah-hud was) all the best compliments and the prayers and the good things are for Allah. Peace and Allah's Mercy and Blessings be on you, O Prophet! Peace be on us and on the pious slaves of Allah, I testify that none has the right to be worshipped but Allah, and I also testify that Muhammad is Allah's slave and His Apostle. (We used to recite this in the prayer) during the lifetime of the Prophet , but when he had died, we used to say, "Peace be on the Prophet."
حَدَّثَنَا أَبُو نُعَيْمٍ، حَدَّثَنَا سَيْفٌ، قَالَ سَمِعْتُ مُجَاهِدًا، يَقُولُ حَدَّثَنِي عَبْدُ اللَّهِ بْنُ سَخْبَرَةَ أَبُو مَعْمَرٍ، قَالَ سَمِعْتُ ابْنَ مَسْعُودٍ، يَقُولُ عَلَّمَنِي رَسُولُ اللَّهِ صلى الله عليه وسلم وَكَفِّي بَيْنَ كَفَّيْهِ التَّشَهُّدَ، كَمَا يُعَلِّمُنِي السُّورَةَ مِنَ الْقُرْآنِ التَّحِيَّاتُ لِلَّهِ وَالصَّلَوَاتُ وَالطَّيِّبَاتُ، السَّلاَمُ عَلَيْكَ أَيُّهَا النَّبِيُّ وَرَحْمَةُ اللَّهِ وَبَرَكَاتُهُ، السَّلاَمُ عَلَيْنَا وَعَلَى عِبَادِ اللَّهِ الصَّالِحِينَ، أَشْهَدُ أَنْ لاَ إِلَهَ إِلاَّ اللَّهُ وَأَشْهَدُ أَنَّ مُحَمَّدًا عَبْدُهُ وَرَسُولُهُ. وَهْوَ بَيْنَ ظَهْرَانَيْنَا، فَلَمَّا قُبِضَ قُلْنَا السَّلاَمُ. يَعْنِي عَلَى النَّبِيِّ صلى الله عليه وسلم.
This means that when The Prophet (PBUH) was alive Ibn Mas'ud recited it in the presence form (Assalamu 'alaika ayyuha annabiu - peace be upon you O Prophet), when he died Ibn Mas'ud recited it in the absence form (Assalmu ala Annaby - peace be upon the Prophet).
However, it should be known that too many scholars don't consider this Hadith an evidence that hadith changed, because Ibn Mas'ud said that they changed that form, but didn't say that the Prophet (PBUH) told them to do, while he did say that the Prophet (PBUH) taught them tashahhud as he would teach them Sura from the Qur'an, and since Qur'an never changes, then Tashahhud shouldn't change. I won't explain more as the question is limited to the Hadith and the new form.
I have heard from a scholar that the Companions of the Prohpet SAW changed it to Assalamu Ala but then changed it back because they argued that Prophet SAW never gave any instructions to that and Muslims are supposed to say their prayers as Prophet SAW did so we should say as he used to. If its the matter of his presence or not, one could also argue that Prophet SAW himself shouldnt have said Assalamu alaka because he was not a second person for himself.
PS. Ill try to find out the reference for what I heard....then Ill update. Inshallah!