I have made an example project for you which demonstrates how you can change the device descriptor dynamically.I have tested at my end using Keil compiler and its working fine.
I took the basic bulkloop example and did the following changes:
1. Added another device descriptor with name DeviceDscr1, and changed the vid and serial number in file dscr.a51.
2. In dscr.a51 also added DeviceDscr1 in the public definition(Line 32).
3. Declared DeviceDscr1 as extern in fx2.h(Line 297).
4. In fw.c I added this code
if( flag )
pDeviceDscr = (WORD)&DeviceDscr;
pDeviceDscr = (WORD)&DeviceDscr1;
so this will choose the descriptor according to the flag value.Instead you can add your logic to choose the descriptor and you can add more device descriptors similarly.
I have attached the project, Please let me know if you can see it working at your end.