My mother died 22 years ago, I have no clue what anyone said to me at the time.
My baby died though when she was 1 day old, 12 years ago, someone said to me, something like;
that there are no words right now that can make things right but please know that I am thinking of you and I'm here if there is anything I can do for you.
I always remembered that she said that, I always remember her for that as it felt like the perfect thing to say at the time. You'd be surprised how many people say stupid things or hurtful things, in the midst of all that it was nice to hear something sensible and nice!