Anas bin Malik (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said about a man who had made a bequest for Hajj: "Four Hajjs are recorded for it: (1) a Hajj for the one who wrote it, (2) a Hajj for the one who carried it out, (3) a Hajj for the one who undertook it, and (4) a Hajj for the one who ordered it."
This Ziyad bin Sufyan is majhul (unknown), and the chain is da'if (weak). Reports have also been narrated about performing Hajj on behalf of parents with weak chains, so I have left them out; and some of what we have narrated is sufficient. And success is from Allah.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 9856