Sayyiduna Ali (may Allah be pleased with him) narrates that I saw the Messenger of Allah (peace and blessings be upon him) stand up for a funeral, so we also stood up. And I saw him (upon seeing a funeral) remain seated, so we also remained seated.
Hadith Referenceالمنتقى ابن الجارود / كتاب الجنائز / 529