How can a database parameter be used on `sp_addextendedproperty`?
The grammar for exec accepts a @module_name_var which allows the module name to be in a variable.

This does accepts three part names so the below does the trick.

DECLARE @DbName SYSNAME = 'AdventureWorks2012';
DECLARE @module_name_var NVARCHAR(500) = QUOTENAME(@DbName) + 
                                              '.sys.sp_addextendedproperty';

EXEC @module_name_var
  @name = N'Caption',
  @value = 'AdventureWorks2012 Sample OLTP Database'; 


Or alternatively having just reviewed the question again you may just need this anyway.

EXEC AdventureWorks2012.sys.sp_addextendedproperty
  @name = N'Caption',
  @value = 'AdventureWorks2012 Sample OLTP Database';