What am I?

You bury me when I’m alive and dig me up when I’m dead. What am I?