I started capturing the following error after performing failover into secondary replica for the database which was using the always encrypted feature of SQL Server 2017 Enterprise Edition:
Some parameters or columns of the batch require to be encrypted, but the corresponding column encryption key cannot be found. Use sp_refresh_parameter_encryption to refresh the module parameters metadata.
For your information, I have set the same service master key on both replicas meaning that data master key is still protected by the same service master key.
Maybe someone has any ideas why this could happen and what could be the solution? I just found a different solution through forums which suggest to clear the procedure cache for the database after failover. I am not sure if that would help.