It depends on whether the ticket is revalidated or reissued. if the ticket is reissued (new ticket number after change), you will receive business class miles. If the ticket is revalidated (same ticket number after change), you will earn miles based on the original fare booked.
Strictly speaking, they're supposed to revalidate the ticket (and you're supposed to earn miles based on the original fare booked). However, some stations may process the upgrade as an upfare instead or make a mistake processing the ticket, so it's very possible to get lucky and earn business class miles.