Aamir bin Rabee’ah narrates that the Messenger of Allah (peace and blessings be upon him) said: When you see a funeral procession, stand up for it (and remain standing) until the funeral passes by you or it is placed down.
Hadith Referenceمسند الإمام الشافعي / كتاب الجنائز / 580
Hadith Takhrijاخرجه البخاري، الجنائز، باب القيام للجنازة (1307) ومسلم، الجنائز، باب القيام للجنازة (958)۔