كتاب الجنائز
11  
The Book of Prayer - Funerals
(24)
Chapter: Standing for funerals
(24)
باب الْقِيَامِ لِلْجَنَازَةِ ‏‏
Sahih Muslim 958 a

It is narrated on the authority of 'Amir Ibn Rabi'a (may Allah be pleased with him) that the Prophet (ﷺ) said:

Whenever you see a funeral procession, stand up for that until it moves away or is lowered on the ground.
وَحَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَعَمْرٌو النَّاقِدُ، وَزُهَيْرُ بْنُ حَرْبٍ، وَابْنُ، نُمَيْرٍ قَالُوا حَدَّثَنَا سُفْيَانُ، عَنِ الزُّهْرِيِّ، عَنْ سَالِمٍ، عَنْ أَبِيهِ، عَنْ عَامِرِ بْنِ رَبِيعَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ إِذَا رَأَيْتُمُ الْجَنَازَةَ فَقُومُوا لَهَا حَتَّى تُخَلِّفَكُمْ أَوْ تُوضَعَ ‏"‏ ‏.‏
Reference : Sahih Muslim 958a
In-book reference : Book 11, Hadith 95
USC-MSA web (English) reference : Book 4, Hadith 2090
  (deprecated numbering scheme)