This is actually a slight bit tricky. The corpse (or dust pile) is created in make_corpse(), which is called from raw_kill() which again is called from die() which is called from damage(), where the autoloot code resides.
So, you will need to get the name of the object created in make_corpse() to bubble out to the damage() function.
My suggestion is to make all of the functions above return a struct obj_data* instead of void. So, make_corpse() returns the created corpse object, which is returned from raw_kill(), and again from die().
Then, in damage(), just either use it directly or use obj->name instead of the hardcoded "corpse".
This will require some rewriting inside fight.c, but mostly it's a question of changing return values and setting up variables.