It is an issue of dispute among the scholars. The most authentic hadeeth which is in Albukhari states that ibn masoud may Allah be pleased with him said that when the Prophet salla Allahu alaihi wa sallam was alive, we used to say: assalamu alaika ayuha annabi. But when he died, we used to say: assalamu ala annabi.