It you took value from xml as varchar, you cannot convert it into format YYYYMMDD (because it's already varchar), you have to convert it to date (or datetime first):
select convert(varchar(8), convert(datetime,
substring(
@data.value('(/ActiveService/@TimePeriod)[1]','nvarchar(50)'), 29, 10
), 120), 112)
But in your case it could be easier just remove -
, by replace(<your value>, '-', '')
.