Modals dynamic ID (identify unique modal)

Hi, is possible to open a modal using a dynamic ID and then remove it (using always the modal ID)?

Thanks for your help